﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

using SilverLightDemo.ServiceReference1;

namespace SilverLightDemo
{
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
            //this.button1.Click+=new RoutedEventHandler(button1_Click);
            Service1Client webclient = new Service1Client();
            webclient.GetAllDataCompleted += new EventHandler<GetAllDataCompletedEventArgs>(webclient_GetAllDataCompleted);
            webclient.GetAllDataAsync();
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            //test demo
            MessageBox.Show("fsdf");
        }

        void webclient_GetAllDataCompleted(object sender, GetAllDataCompletedEventArgs e)
        {
            List<College> college = new List<College>(e.Result);
            dataGrid1.ItemsSource = college;
        }
    }
}